// RSSFeed.h: interface for the RSSFeed class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_RSSFEED_H__83DDB42F_EB1D_4D26_916D_C43F8604B6EE__INCLUDED_)
#define AFX_RSSFEED_H__83DDB42F_EB1D_4D26_916D_C43F8604B6EE__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "util.h"

struct RSSItem{
	RSSItem(string& t,string &l, string &d):title(t),link(l),description(d){};
	RSSItem(const char* t,const char* l, const char* d){
		if(t) title=t;
		if(l) link=l;
		if(d) description=d;
	}
	string link;
	string title;
	string description;
};


class RSSFeed  
{
	friend class CFeedTree;
	friend class DBManager;
	friend class RSSParser;
	friend class FeedFetcher;
public:
	RSSFeed();
	RSSFeed(const char* link, const char* title, int nGroup, const char* description = NULL, int nFeedID = 0){
		m_strChannelLink = link;
		m_strChannelTitle = title;
		m_nFeedGroupID = nGroup;
		if(description){
			m_strDescription = description;
		}else{
			m_strDescription = "";
		}
		m_nFeedID = nFeedID;
	};
	virtual ~RSSFeed();
	string GetEncoding(){				
		return tolower(m_strEncoding);
	}
	const char* GetTitle(){				
		return m_strChannelTitle.c_str();
	}
	const char* GetLink(){				
		return m_strChannelLink.c_str();
	}

	vector<RSSItem> * GetItems(){
		return &m_Items;
	}

private:	
	// the following two id will be filled by DBManager
	int m_nFeedID;         
	int m_nFeedGroupID;


	string m_strEncoding;
	string m_strVersion;
	
	string m_strChannelLink;
	string m_strChannelTitle;
	string m_strChannelPubdate;
	string m_strDescription;
	vector<RSSItem> m_Items;
protected:
	void Reset();

};

#endif // !defined(AFX_RSSFEED_H__83DDB42F_EB1D_4D26_916D_C43F8604B6EE__INCLUDED_)
